﻿@*@model IEnumerable<Movies.Models.Movie>*@
@model Movies.Models.MovieGenreViewModel

@{
    ViewData["Title"] = "电影列表";
}

<!-- Main content -->
    <section class="content">
        <div class="container-fluid">
            <form asp-controller="Movies" asp-action="Index" method="get">
                <div class="row">
                    <div class="col-md-10 offset-md-1">
                        <div class="row">
                            <div class="col-6">
                                <div class="form-group">
                                    <label>电影类别:</label>
                                    <select asp-for="GenreSelected" asp-items="@Model.Genres" class="select2" multiple="multiple" data-placeholder="Any" style="width:100%">
                                    </select>
                                </div>
                            </div>
                            <div class="col-3">
                                <div class="form-group">
                                    <label>Sort Order:</label>
                                    <select class="select2"  style="width: 100%;">
                                        <option selected>ASC</option>
                                        <option>DESC</option>
                                    </select>
                                </div>
                            </div>
                            <div class="col-3">
                                <div class="form-group">
                                    <label>Sort Order:</label>
                                    <select class="select2"  style="width: 100%;">
                                        <option selected>ASC</option>
                                        <option>DESC</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label>电影名：</label>
                            <div class="input-group input-group-lg">
                                <input type="search" class="form-control form-control-lg" placeholder="请输入电影名" asp-for="SearchString">
                                <div class="input-group-append">
                                    <button type="submit" class="btn btn-lg btn-default">
                                        <i class="fa fa-search"></i>
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
            <table class="table  table-striped projects">
                <thead>
                    <tr>
                        <th style="width: 20%">
                            @Html.DisplayNameFor(model => model.Movies[0].Title)
                        </th>
                        <th style="width: 20%">
                            @Html.DisplayNameFor(model => model.Movies[0].ReleaseDate)
                        </th>
                        <th style="width: 20%">
                            @Html.DisplayNameFor(model => model.Movies[0].Genre)
                        </th>
                        <th style="width: 20%">
                            @Html.DisplayNameFor(model => model.Movies[0].Price)
                        </th>
                        <th></th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (var item in Model.Movies)
                    {
                        <tr>
                            <td>
                                @Html.DisplayFor(modelItem => item.Title)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.ReleaseDate)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.Genre)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.Price)
                            </td>
                            <td>
                                <a asp-action="Create" class="btn btn-success btn-sm">Add</a>
                                <a asp-action="Edit" asp-route-id="@item.Id" class="btn btn-info btn-sm">Edit</a>
                                <a asp-action="Details" asp-route-id="@item.Id" class="btn btn-primary btn-sm">Details</a>
                                <a asp-action="Delete" asp-route-id="@item.Id" class="btn btn-danger btn-sm">Delete</a>
                            </td>
                        </tr>
                    }
                </tbody>
            </table>
        </div>
    </section>
<!-- /.content -->
